package com.xzit.servlet;

import com.xzit.data.DataBase;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author haoranlu
 * @project IntelliJ IDEA
 */
public class ForeachServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

//        req.getSession().setAttribute("cars",DataBase.getCarlist());

//        resp.sendRedirect("foreach.jsp");

        req.setAttribute("names",DataBase.getNames());
        req.getRequestDispatcher("fortokens.jsp").forward(req,resp);

    }
}
